from django.db import models

# Create your models here.

from django.db import models

class BookInfo(models.Model):
    # 准备书籍列表信息的模型类
    # 创建字段，字段类型...
    name = models.CharField(max_length=10)
    age=models.CharField(max_length=3)

    def __str__(self):
        return self.name

class PeopleInfo(models.Model):
    # 准备人物列表信息的模型类
    name = models.CharField(max_length=10)
    gender = models.BooleanField()
    book = models.ForeignKey(BookInfo,on_delete=models.CASCADE)  # 外键约束：人物属于哪本书
